package com.nuoniu.sibanyun.controller.expenses;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.expenses.dto.ExpensesAccountSearchDto;
import com.nuoniu.sibanyun.entity.expenses.dto.ExpensesPaymentOrderSearchDto;
import com.nuoniu.sibanyun.service.expenses.IExpensesPaymentOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * <p>
 * 费用中心-支付订单 前端控制器
 * </p>
 *
 * @author 白强
 * @since 2022-05-06
 */
@RestController
@RequestMapping("/expenses/paymentOrder")
@Api(value="费用中心-支付订单 ",tags={"费用中心-支付订单"})
public class ExpensesPaymentOrderController extends BaseController {

    @Autowired
    private IExpensesPaymentOrderService paymentOrderService;

    @PostMapping("pageList")
    @ApiOperation(value = "分页查询 支付订单（系统）")
    @PreAuthorize("'system' == authentication.principal ")
    public HttpResult pageList(@RequestBody ExpensesPaymentOrderSearchDto paymentOrderSearchDto) {
        return HttpResult.ok(paymentOrderService.pageList(paymentOrderSearchDto));
    }

    @PostMapping("createPayOrder")
    @ApiOperation(value = "创建支付订单")
    public HttpResult createPayOrder(BigDecimal amount) {
        return HttpResult.ok(paymentOrderService.createPayOrder(amount));
    }


}
